nginx -t
if [ $? -eq 0 ]; then
  echo "nginx check success"
else
  echo "nginx check fail"
  exit 2
fi
nginx -s reload